// ==UserScript==
// @name         车辆看板
// @namespace    none
// @version      0.8
// @description  CSS修改脚本
// @author       Rainbow
// @match        *://172.20.50.11/auth/login.html*
// @run-at       document-idle
// ==/UserScript==

(function() {
    'use strict';
    // Your code here...
    console.log('Rainbow script Of train')
    let username = '01010011334'
    let pwd = 'Sh0299123!@#'
    //填写用户名
    // let usernameInput = document.querySelector(pathOfusernameInput)
    // usernameInput.value = username
    // //填写密码
    // let pwdInput = document.querySelector(pathOfpwdInput)
    // pwdInput.value = pwd
    //点击登陆
    //document.querySelector(pathOfBtn).click()
    simLogin()
    function simLogin()
    {
        if($ != undefined && $ != null)
        {
            let mod = GetQueryString("tm_mod")
            if(mod)
            {
                localStorage.setItem('tm_mod',mod)
            }else{
                localStorage.setItem('tm_mod',0)
            }
            if($("#username") != null & $("#password") != null)
            {
                $("#username").val(username);
                $("#password").val(pwd);
                document.getElementById('loginForm').submit();
            }
        }
    }

    function GetQueryString(name) { 
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); 
        var r = window.location.search.substr(1).match(reg);  //获取url中"?"符后的字符串并正则匹配
        var context = ""; 
        if (r != null) 
             context = r[2]; 
        reg = null; 
        r = null; 
        return context == null || context == "" || context == "undefined" ? "" : context; 
    }
})();